import numpy as np
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontProperties

font_path=r"c:\windows\fonts\微软雅黑.ttc"
font = FontProperties(fname=font_path, size=9)

plt.rcParams['font.sans-serif'] = ['SimHei', 'Arial', 'sans-serif']

# 定义抛物线方程 y = ax^2 + bx + c
a = 10
b = 6
c = 9

# 生成 x 值的范围
x = np.linspace(-10, 10, 100)

# 计算对应的 y 值
y = a * x**2 + b * x + c

# 绘制抛物线
plt.plot(x, y, label=f'y = {a}x^2 + {b}x + {c}')

# 添加标题和标签
plt.title('抛物线')
plt.xlabel('x')
plt.ylabel('y')

# 添加图例
plt.legend()

# 显示网格
plt.grid(True)

# 显示图形
plt.show()
